{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'sklearn'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdatasets\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m fetch_california_housing\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mxgboost\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m XGBRegressor\n\u001b[1;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodel_selection\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m train_test_split\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sklearn'"
     ]
    }
   ],
   "source": [
    "from sklearn.datasets import fetch_california_housing\n",
    "from xgboost import XGBRegressor\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from sklearn.model_selection import cross_validate\n",
    "from matplotlib import pyplot as plt\n",
    "from sklearn.model_selection import GridSearchCV   \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "x,y=fetch_california_housing(return_X_y=True,as_frame=True)\n",
    "xtrain,xtest,ytrain,ytest=train_test_split(x,y,test_size=0.3,random_state=42)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ytrain.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.8386161788339781\n",
      "mes:0.21182273803266358\n"
     ]
    }
   ],
   "source": [
    "xgb=XGBRegressor(random_state=0,max_depth=3)\n",
    "xgb.fit(xtrain,ytrain)\n",
    "print(xgb.score(xtest,ytest))\n",
    "print('mes:{}'.format(mean_squared_error(ytest,xgb.predict(xtest))))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] END .................................................... total time=   0.1s\n",
      "[CV] END .................................................... total time=   0.2s\n",
      "[CV] END .................................................... total time=   0.2s\n",
      "[CV] END .................................................... total time=   0.2s\n",
      "[CV] END .................................................... total time=   0.2s\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8ekN5oAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA1NElEQVR4nO3de3iU1bn+8XsSMpNzAMGgEA0KchBIIAFEa0WNgLhRbG2RWoFU2d1VbG22/QnVgoASFMQooLhVtNq6odtKtR5AiBw8IMeiiIpVOQpJQCEhATJhZn5/LJMQSGAmJFmZme/nunLBzLwz88RIcmc9631eh8/n8wkAAMCSCNsFAACA8EYYAQAAVhFGAACAVYQRAABgFWEEAABYRRgBAABWEUYAAIBVhBEAAGBVC9sF+MPr9WrPnj1KSEiQw+GwXQ4AAPCDz+fToUOHdO655yoiou71j6AII3v27F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r16qbi4WDNnztSll16qLVu2qEOHDrU+Jzc3V5MnTw6kNABAODlwoDp4VIaPf/+79mPbt6+52tGnj3TuuU1bL06p0c+mGTBggAYMGFB1+9JLL1W3bt309NNPa+rUqbU+Z8KECcrJyam6XVJSohSLlzYGAFj03Xcnj0v/5pvajz3vvJqrHX36mFUQNGsBhZE2bdooMjJShYWFNe4vLCz0e09IVFSUevfura+++qrOY1wul1xhNHkOAPCDoqKawWPDBnPRuNpccEHN1Y4+fcy+DwSdgMKI0+lURkaG8vPzNXz4cEmS1+tVfn6+xo0b59dreDwebd68WUOHDg242FAycOBApaenKy8vr0Feb8yYMTp48KD+8Y9/NMjrAUCj27u3Zptlwwbp229rP7Zz55ODR6tWTVsvGk3AbZqcnByNHj1amZmZ6tevn/Ly8lRWVlZ1ds2oUaPUvn175ebmSpKmTJmiSy65RJ06ddLBgwc1Y8YM7dixQ7fffnvDfiYAgObJ55N2767ZZtmwQSooOPlYh8MMCzt+j0d6upntgZAVcBgZMWKE9u3bp4kTJ6qgoEDp6elavHhx1abWnTt3KuK4868PHDigsWPHqqCgQK1atVJGRoY+/PBDde/eveE+iyAzZswYrVy5UitXrtTjjz8uSdq2bZtKS0v1hz/8Qe+9957i4uI0aNAgPfbYY2rzw7LjK6+8osmTJ+urr75SbGysevfurddee00zZszQn//8Z0nVM1yWL1+ugQMHWvn8AIQxn0/asePkPR779p18bESEGY9+YvCIj2/ysmFX6F0oz+czA21siI3167Sw4uJiXXvtterRo4emTJkiyeyl6datm26//XaNGjVKR44c0b333qtjx47p3Xff1d69e3XeeefpkUce0Y033qhDhw7pvffe06hRoyRJt912m0pKSqqu/tu6dWs5A7jwEhfKA1AvR49Kb7whrV9fHTy+//7k4yIjpYsvrrm5NC3NfN9EyArfC+UdPmwvVZeWSnFxpz0sKSlJTqdTsbGxVRt/H3zwQfXu3VvTpk2rOm7+/PlKSUnRl19+qdLSUh07dkw/+clPdP7550uSevbsWXVsTEyMysvLGS4HoOmsWyeNGmWuWHu8qCipZ8+aezx69TJXrAVqEXphJEh9/PHHWr58ueJrCVJff/21Bg0apKuvvlo9e/bU4MGDNWjQIN10001qxQYuAE2tokJ66CHpwQfNCPV27aQbbqhe9bj4YokzIhGA0AsjsbFmhcLWe9dTaWmphg0bpocffvikx8455xxFRkZq6dKl+vDDD/XOO+9o9uzZuu+++7RmzRp17NjxTKoGAP99/rl0662mJSNJN98szZ0rtW5tty4EtdALIw6HX60S25xOpzzHXZSpT58++vvf/67U1FS1aFH7l8XhcOiyyy7TZZddpokTJ+r888/XokWLlJOTc9LrAUCD8nqlJ56Qxo+XysvNabVPPmnCCHCGuOygJampqVqzZo22b9+u/fv3684779T333+vkSNHat26dfr666+1ZMkSZWdny+PxaM2aNZo2bZrWr1+vnTt36tVXX9W+ffvUrVu3qtf75JNPtHXrVu3fv18VtV32GgDqY8cO6eqrpd//3gSRIUOkTz8liKDBEEYsueeeexQZGanu3burbdu2crvd+uCDD+TxeDRo0CD17NlTd999t1q2bKmIiAglJiZq1apVGjp0qC666CLdf//9evTRR3XttddKksaOHasuXbooMzNTbdu21QcffGD5MwQQ9Hw+6YUXzGbUFStMK3rePOmtt7i2CxpU6J3ai3rhvyOAGoqKpP/8T+m118ztSy+V/vxnqVMnu3UhqPh7ai8rIwCAmhYtknr0MEEkKkqaPl1atYoggkYTehtYAQD1U1ws/fa30osvmtu9ekkvvWT+BBoRKyMAACk/3+wNefFFM6Z9wgRp7VqCCJoEKyMAEM4OHzbB44knzO0LLzSB5NJL7daFsEIYAYBwtXatGee+dau5/ZvfSI88woXq0ORCpk0TBCcFNWv89wPCSEWFNGmSWf3YutWcpvv222aIGUEEFgT9ykhkZKQkye12KyYmxnI1wevwD1c6joqKslwJgEb12WdmnPvGjeb2yJHSnDmMc4dVQR9GWrRoodjYWO3bt09RUVGKiAiZxZ4m4fP5dPjwYRUVFally5ZV4Q5AiPF6pccfN/tDystN+HjySWnECNuVAcEfRhwOh8455xxt27ZNO3bssF1O0GrZsqXatWtnuwwAjWH7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PPXUU3K73brppptqvM6kSZP0wAMPnFn1AAAg6AU8Z8QG5owAABB8GmXOCAAAQEMjjAAAAKsIIwAAwCrCCAAAsIowAgAArCKMAAAAqwgjAADAKsIIAACwijACAACsIowAAACrCCMAAMAqwggAALCKMAIAAKwijAAAAKsIIwAAwCrCCAAAsIowAgAArCKMAAAAqwgjAADAKsIIAACwijACAACsIowAAACrCCMAAMAqwggAALCKMAIAAKwijAAAAKsIIwAAwCrCCAAAsIowAgAArCKMAAAAqwgjAADAKsIIAACwijACAACsIowAAACrCCMAAMAqwggAALCKMAIAAKwijAAAAKsIIwAAwCrCCAAAsIowAgAArCKMAAAAqwgjAADAKsIIAACwijACAACsIowAAACrCCMAAMAqwggAALCKMAIAAKwijAAAAKsIIwAAwCrCCAAAsIowAgAArCKMAAAAqwgjAADAKsIIAACwijACAACsIowAAACrCCMAAMAqwggAALCKMAIAAKwijAAAAKvqFUbmzp2r1NRURUdHq3///lq7dm2dx27ZskU//elPlZqaKofDoby8vPrWCgAAQlDAYWThwoXKycnRpEmTtHHjRqWlpWnw4MEqKiqq9fjDhw/rggsu0PTp09WuXbszLhgAAISWgMPIrFmzNHbsWGVnZ6t79+6aN2+eYmNjNX/+/FqP79u3r2bMmKGbb75ZLpfrjAsGAAChJaAw4na7tWHDBmVlZVW/QESEsrKytHr16gYrqry8XCUlJTU+AABAaAoojOzfv18ej0fJyck17k9OTlZBQUGDFZWbm6ukpKSqj5SUlAZ7bQAA0Lw0y7NpJkyYoOLi4qqPXbt22S4JAAA0khaBHNymTRtFRkaqsLCwxv2FhYUNujnV5XKxvwQAgDAR0MqI0+lURkaG8vPzq+7zer3Kz8/XgAEDGrw4AAAQ+gJaGZGknJwcjR49WpmZmerXr5/y8vJUVlam7OxsSdKoUaPUvn175ebmSjKbXj/77LOqv3/77bfatGmT4uPj1alTpwb8VAAAQDAKOIyMGDFC+/bt08SJE1VQUKD09HQtXry4alPrzp07FRFRveCyZ88e9e7du+r2zJkzNXPmTF1xxRVasWL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755zVmzJimLwgBKyoq0qhRo7R3714lJSWpV69eWrJkia655hrbpSEIhe2cEQAA0DyE5Z4RAADQfBBGAACAVYQRAABgFWEEAABYRRgBAABWEUYAAIBVhBEAAGAVYQQAAFhFGAEAAFYRRgAAgFWEEQAAYBVhBAAAWPX/AQyC0e46cde+AAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "result=cross_validate(xgb,x,y,scoring='neg_mean_squared_error',cv=5,return_train_score=True,verbose=2)\n",
    "# result\n",
    "plt.plot(range(5),abs(result['train_score']),color='green',label='train')\n",
    "plt.plot(range(5),abs(result['test_score']),color='red',label='test')\n",
    "plt.xticks(range(5))\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-0.4382918055000376\n",
      "-0.0695356022338333\n"
     ]
    }
   ],
   "source": [
    "print(result['test_score'].mean())\n",
    "print(result['train_score'].mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.47133702 0.06724948 0.04234439 0.02701515 0.02391342 0.15796666\n",
      " 0.09467026 0.11550353]\n",
      "Index(['MedInc', 'HouseAge', 'AveRooms', 'AveBedrms', 'Population', 'AveOccup',\n",
      "       'Latitude', 'Longitude'],\n",
      "      dtype='object')\n"
     ]
    }
   ],
   "source": [
    "print(xgb.feature_importances_)\n",
    "print(x.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "from xgboost import XGBClassifier\n",
    "from sklearn.datasets import load_breast_cancer\n",
    "from sklearn.datasets import load_wine\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "xbinary,binary=load_breast_cancer(return_X_y=True,as_frame=True)\n",
    "xmulti,ymulti=load_wine(return_X_y=True,as_frame=True)\n",
    "\n",
    "xtrain1,xtest1,ytrain1,ytest1=train_test_split(xbinary,binary,test_size=0.3,random_state=42)\n",
    "xtrain2,xtest2,ytrain2,ytest2=train_test_split(xmulti,ymulti,test_size=0.3,random_state=42)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n",
      "0.9707602339181286\n",
      "1.0\n",
      "0.9629629629629629\n"
     ]
    }
   ],
   "source": [
    "xgb1=XGBClassifier(random_state=0)\n",
    "xgb1.fit(xtrain1,ytrain1)\n",
    "print(xgb1.score(xtrain1,ytrain1))\n",
    "print(xgb1.score(xtest1,ytest1))\n",
    "\n",
    "xgb2=XGBClassifier(random_state=0)\n",
    "xgb2.fit(xtrain2,ytrain2)\n",
    "print(xgb2.score(xtrain2,ytrain2))\n",
    "print(xgb2.score(xtest2,ytest2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>二分类</th>\n",
       "      <th>多分类</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>objective</th>\n",
       "      <td>binary:logistic</td>\n",
       "      <td>multi:softprob</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>base_score</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>booster</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>callbacks</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>colsample_bylevel</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>colsample_bynode</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>colsample_bytree</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>device</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>early_stopping_rounds</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>enable_categorical</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>eval_metric</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>feature_types</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gamma</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>grow_policy</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>importance_type</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>interaction_constraints</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>learning_rate</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_bin</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_cat_threshold</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_cat_to_onehot</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_delta_step</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_depth</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max_leaves</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min_child_weight</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>missing</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>monotone_constraints</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>multi_strategy</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>n_estimators</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>n_jobs</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>num_parallel_tree</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>random_state</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>reg_alpha</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>reg_lambda</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sampling_method</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>scale_pos_weight</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>subsample</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tree_method</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>validate_parameters</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>verbosity</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     二分类             多分类\n",
       "objective                binary:logistic  multi:softprob\n",
       "base_score                          None            None\n",
       "booster                             None            None\n",
       "callbacks                           None            None\n",
       "colsample_bylevel                   None            None\n",
       "colsample_bynode                    None            None\n",
       "colsample_bytree                    None            None\n",
       "device                              None            None\n",
       "early_stopping_rounds               None            None\n",
       "enable_categorical                 False           False\n",
       "eval_metric                         None            None\n",
       "feature_types                       None            None\n",
       "gamma                               None            None\n",
       "grow_policy                         None            None\n",
       "importance_type                     None            None\n",
       "interaction_constraints             None            None\n",
       "learning_rate                       None            None\n",
       "max_bin                             None            None\n",
       "max_cat_threshold                   None            None\n",
       "max_cat_to_onehot                   None            None\n",
       "max_delta_step                      None            None\n",
       "max_depth                           None            None\n",
       "max_leaves                          None            None\n",
       "min_child_weight                    None            None\n",
       "missing                              NaN             NaN\n",
       "monotone_constraints                None            None\n",
       "multi_strategy                      None            None\n",
       "n_estimators                        None            None\n",
       "n_jobs                              None            None\n",
       "num_parallel_tree                   None            None\n",
       "random_state                           0               0\n",
       "reg_alpha                           None            None\n",
       "reg_lambda                          None            None\n",
       "sampling_method                     None            None\n",
       "scale_pos_weight                    None            None\n",
       "subsample                           None            None\n",
       "tree_method                         None            None\n",
       "validate_parameters                 None            None\n",
       "verbosity                           None            None"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame([xgb1.get_params(),xgb2.get_params()],index=['二分类','多分类']).T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install xgboost"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py",
   "language": "python",
   "name": "py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.23"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
